<template>
  <div class="xiaoinfo-container">
    <van-nav-bar
        title=""
        left-text=""
        right-text=""
        left-arrow
        @click-left="onClickLeft"
    />

    <!-- 用户基本信息面板 -->
    <div class="user-card">
      <!-- 用户头像、姓名 -->
      <van-cell>
        <!-- 使用 title 插槽来自定义标题 -->
        <template #icon>
          <img src="../../assets/xiaoai.webp" alt="" class="avatar"/>
          <!-- <van-image
               class="avatar"
               lazy-load
               src="../../assets/caoshen.jpg"-
           />-->
        </template>
        <template #title>
          <span class="username">{{ userinfo }}</span>
        </template>
        <template #label>
          <van-tag color="#fff" text-color="#007bff">官方认证</van-tag>
        </template>
      </van-cell>
      <!-- 动态、关注、粉丝 -->
      <div class="user-data">
        <div class="user-data-item">
          <span>{{ dynamic }}</span>
          <span>动态</span>
        </div>
        <div class="user-data-item">
          <span>{{ about }}</span>
          <span>关注</span>
        </div>
        <div class="user-data-item">
          <span>{{ fan }}</span>
          <span>粉丝</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Xiaoinfo",
  data() {
    return {
      userinfo:'小爱同学',
      dynamic: 0,
      about: 1,
      fan: 100,
    }
  },
  methods:{
    onClickLeft(){
      // go(-1) 表示后退一层
      this.$router.go(-1)
    },
  }

}
</script>

<style lang="less" scoped>
.xiaoinfo-container {
  .user-card {
    background-color: #007bff;
    color: white;
    padding-top: 20px;

    .van-cell {
      background: #007bff;
      color: white;

      &::after {
        display: none;
      }

      .avatar {
        width: 60px;
        height: 60px;
        background-color: #fff;
        border-radius: 50%;
        margin-right: 10px;
      }

      .username {
        font-size: 14px;
        font-weight: bold;
      }
    }
  }

  .user-data {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    font-size: 14px;
    padding: 30px 0;

    .user-data-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 33.33%;
    }
  }

  .van-nav-bar{
    background-color: #007bff;
  }
  /deep/.van-nav-bar__title{
    color: white;
  }
  /deep/.van-nav-bar__arrow{
    color: white;
  }
  /deep/.van-nav-bar__text{
    color: white;
  }
}
</style>